package com.practice.J2E.util;

import cn.hutool.core.collection.CollUtil;
import com.practice.J2E.util.dto.AirportDTO;
import com.practice.J2E.util.dto.AirportDTOGroup;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.function.Function;
import java.util.stream.Collectors;
import java.util.stream.Stream;

/**
 * desc
 *
 * @author: kayn
 * 2024-12-27 17:27
 **/
public class GroupUtil {



    public static void main(String[] args) {

        ArrayList<AirportDTO> dtoList = CollUtil.newArrayList(
                AirportDTO.create("A", "B", "C", "1"),
                AirportDTO.create("D", "E", "F", "2"),
                AirportDTO.create("A", "B", "C", "3"),
                AirportDTO.create("D", "E", "F", "4")
                );

        List<AirportDTOGroup> groupList = dtoList.stream().flatMap(new Function<AirportDTO, Stream<AirportDTOGroup>>() {
            @Override
            public Stream<AirportDTOGroup> apply(AirportDTO airportDTO) {

                return Stream.empty();
            }
        }).toList();

        Map<String, AirportDTO> collect = dtoList.stream().collect(Collectors.toMap(AirportDTO::getId, Function.identity()));


    }
}
